import request, { RequestOptionsInit } from '@/utils/request';
import { ShowType } from '@/common/constants';

// 新增用户
export function addUser(data: object): Promise<any> {
  return request('/api/auth/user', {
    method: 'POST',
    data,
    showType: ShowType.MESSAGE_WARNING,
  } as RequestOptionsInit);
}

// 修改用户
export function updateUser(id: string, data: object): Promise<any> {
  return request(`/api/auth/user/${id}`, {
    method: 'PUT',
    data,
    showType: ShowType.MESSAGE_WARNING,
  } as RequestOptionsInit);
}

// 删除用户
export function deleteUser(id: string): Promise<any> {
  return request(`/api/auth/user/${id}`, {
    method: 'DELETE',
    showType: ShowType.MESSAGE_WARNING,
  } as RequestOptionsInit);
}
